<template>
  <div v-if="show" class="loading-container">
    <div class="loading-mask"></div>
    <div class="loading-content">
      <div class="loading-text mgt-10">Loading</div>
      <div class="loading-animate"></div>
      <div class="loading-text">{{text}}</div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Loading',
  props: {
    show: Boolean
  },
  data () {
    return {
      text: '正在执行中...请勿重复操做或关闭页面',
      langtype: localStorage.getItem('language')
    }
  },
  created () {
    console.log(localStorage.getItem('language'))
    // if (localStorage.getItem('language') === 'zh') {
    //   this.text = '正在执行中...请勿重复操做或关闭页面'
    // } else if (localStorage.getItem('language') === 'en') {
    //   this.text = 'In execution... Do not repeat operations or close the page'
    // } else {
    //   this.text = '正在执行中...请勿重复操做或关闭页面'
    // }
    if (this.langtype === 'zh') {
      this.text = '正在执行中...请勿重复操做或关闭页面'
      return
    }
    if (this.langtype === 'en') {
      this.text = 'In progress... do not repeat or close the page'
      return
    }
    if (this.langtype === 'ru') {
      this.text = 'В процессе... не повторять или закрыть страницу'
      return
    }
    if (this.langtype === 'zh-tw') {
      this.text = '正在執行中...請勿重複執行或關閉頁面'
    }
  }
}
</script>
<style scoped>
.loading-container {
  position: relative;
  text-align: center;
  z-index: 9999;
}
.loading-mask {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.7);
}
.loading-content {
  position: fixed;
  left: 50%;
  top: 45%;
  z-index: 300;
  /* width: 35%; */
  transform: translate(-50%, -45%);
  text-align: center;
  color: #fff;
  border-radius: 5px;
  box-sizing: border-box;
  border: 3px solid #7DE9FF;
  padding: 0 30px;
}
.loading-animate {
  display: inline-block;
  width: 135px;
  height: 135px;
  margin: 25px 0 10px;
  vertical-align: middle;
  animation: cricleLoading 1s steps(12, end) infinite;
  background: transparent
    url("../../assets/icon/loading.svg")
    no-repeat;
  background-size: 100%;
}
.loading-text {
  font-family: Inter-Bold;
  font-size: 30px;
  font-weight: bold;
  line-height: 41px;
  text-align: center;
  letter-spacing: 0em;
  color: #7DE9FF;
  margin-bottom: 15px;
}
@-webkit-keyframes cricleLoading {
  0% {
    transform: rotate3d(0, 0, 1, 0deg);
  }
  100% {
    transform: rotate3d(0, 0, 1, 360deg);
  }
}
@keyframes cricleLoading {
  0% {
    transform: rotate3d(0, 0, 1, 0deg);
  }
  100% {
    transform: rotate3d(0, 0, 1, 360deg);
  }
}
</style>
